<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
	die ('Por favor n&atilde;o acesse esta p&aacute;gina diretamente. Obrigado!');
if ( post_password_required() ) {
	echo '<p class="nocomments">Este post est&aacute; protegido por senha. Digite a senha para ver os coment&aacute;rios.</p>';
	return;
}

?>

<div class="clear"></div>


<?php if ( have_comments() ) { ?>
		
	<h2 id="comments"><?php comments_number('Deixe um Coment&aacute;rio', '1 Coment&aacute;rio', '% Coment&aacute;rios' );?></h2>
	
	

	<ol class="commentlist">
	<?php 
	
	if ( function_exists('wp_list_comments') ) : ?>
		<?php wp_list_comments('avatar_size=80&type=comment&callback=custom_comment'); ?>
	<?php else : ?>
		   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
					<!-- the Gravatar -->
					<span class="left"><?php echo get_avatar($comment, 80, 'http://casamenteiras.com.br/wp-content/uploads/2010/03/avatar-casamenteiras.jpg' ); ?><br /><?php comment_author_link() ?></span>
				<?php if ($comment->comment_approved == '0') : ?>
					<p>Seu coment&aacute;rio est&aacute; aguardando modera&ccedil;&atilde;o.</p>
				<?php endif; ?>
				<?php comment_text() ?>
				<p class="meta"><?php comment_date('j \d\e F \d\e Y') ?> &agrave;s <?php comment_time() ?> <?php edit_comment_link('editar','&nbsp;&nbsp;',''); ?></p>
			</li>
	<?php endif; ?>
		
	</ol>

	<div class="navigation">
		<div class="alignleft"><?php previous_comments_link() ?></div>
		<div class="alignright"><?php next_comments_link() ?></div>
	</div>
	
	
	<?php if ( $comments_by_type['pings'] ) : ?>
    <h2 id="pings">Trackbacks/Pingbacks</h3>
    <ol class="commentlist">
    <?php wp_list_comments('type=pings'); ?>
    </ol>
    <?php endif; ?>
    
    
 <?php } else { // this is displayed if there are no comments so far ?>

	<?php if ('open' == $post->comment_status) { ?>
		<!-- If comments are open, but there are no comments. -->

	 <?php } else { // comments are closed ?>
		<!-- If comments are closed. -->
		<p class="nocomments">Os coment&aacute;rios est&atilde;o fechados.</p>

	<?php } } ?>




<div class="clear"></div>

<?php if ('open' == $post->comment_status) : ?>

<div id="respond">
	<h2 class="reply">Deixe seu coment&aacute;rio</h2>
	

	<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
	
		<p><?php cancel_comment_reply_link('',' | '); ?>Voc&acirc; deve estar <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logado</a> para escrever um coment&aacute;rio.</p>
		
	<?php else : ?>
		
		<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
		
		<?php if ( $user_ID ) : ?>
		
			<p><?php cancel_comment_reply_link('',' | '); ?>Logado como <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. 
			<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
			
		<?php else : ?>
		
			<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
			<label for="author"><small>Nome <?php if ($req) echo "(obrigat&oacute;rio)"; ?></small></label></p>
			
			<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
			<label for="email"><small>Email (n&atilde;o ser&aacute; publicado) <?php if ($req) echo "(obrigat&oacute;rio)"; ?></small></label></p>
			
			<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
			<label for="url"><small>Site</small></label></p>

		<?php endif; ?>

			<!--<p><small><strong>XHTML:</strong> Voc&ecirc; pode usar as seguintes tags: <code><?php echo allowed_tags(); ?></code></small></p>-->

			<p><textarea name="comment" id="comment" cols="50" rows="10" tabindex="4"></textarea></p>

			<p><input name="submit" type="submit" id="submit" tabindex="5" value="Enviar" />
			<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></p>
		<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
		
		</form>
<?php endif; // If registration required and not logged in ?>
</div>

<?php endif; // if you delete this the sky will fall on your head ?>